import { z } from 'zod';

export const MESSAGE_EVENT = 'message';
export const NEW_ORDER_EVENT = 'new-order';

export const socketMessageSchema = z.object({
  user: z.object({
    id: z.string(),
    name: z.string(),
    image: z.string().nullable().optional(),
    role: z.string().nullable().optional(),
  }),
  content: z.string(),
  createdAt: z.number(),
});
export type SocketMessage = z.infer<typeof socketMessageSchema>;

export type Message = {
  user: {
    id: string;
    name: string;
    image?: string | null;
    role?: string | null;
  };
  content: string;
  createdAt: number;
};

export type NewOrderNotification = {
  id: number;
  address: string;
  createdAt: Date;
  imageKeys: string[];
};
